home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / telecomm / bbs / bbbbs84.lha / rexx / bbsMan.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1994-12-21  |  7.4 KB  |  281 lines

  1. /* $VER: bbsMan.rexx 8.3 (21.12.94)
  2. Copyright © 1994 Richard Lee Stockton
  3. Offline (LOCAL) BBBBS Manager
  4. FREELY DISTRIBUTABLE
  5. */
  6.  
  7. reader='C:mo'  /* path to YOUR text reader here. I use ppmore */
  8.  
  9. IF ~SHOW('P','QuickSortPort') THEN CALL setup.rexx()
  10. IF ~SHOW('P','QuickSortPort') THEN EXIT 666
  11.  
  12. title.=''
  13. title.1='BBBBS Manager'
  14. title.2='Version 8.3'
  15. title.3='21-Dec-94'
  16.  
  17. def=''
  18. pen3=''
  19. lineup='1B'x'M'
  20.  
  21. figarg='s:CONFIG.BBS'
  22. IF ~EXISTS(figarg) THEN figarg='BBS:BBS_TEXT/CONFIG.BBS'
  23. x=OPEN(f,figarg,'R')
  24. IF x=0 THEN
  25.   DO
  26.     SAY 's:CONFIG.BBS and BBS:BBS/CONFIG.BBS are both missing!'
  27.     EXIT
  28.   END
  29. lynes.=''
  30. DO i=1 TO 40
  31.   lynes.i=READLN(f)
  32. END
  33. CALL CLOSE(f)
  34.  
  35. compos=POS('/*',lynes.1)
  36. IF compos>0 THEN lynes.1=LEFT(lynes.1,compos-1)
  37. bbsname=STRIP(lynes.1)
  38. sysop=WORD(lynes.2,1)
  39. compos=POS('/*',lynes.3)
  40. IF compos>0 THEN lynes.3=LEFT(lynes.3,compos-1)
  41. bbsdevice=WORD(lynes.4,1)
  42. sysoplevel=WORD(lynes.5,1)
  43. bbspath=WORD(lynes.6,1)
  44. IF ~EXISTS(bbspath) THEN
  45.   DO
  46.     SAY bbspath 'does not exist!'
  47.     EXIT
  48.   END
  49. testchar=RIGHT(bbspath,1)
  50. IF testchar~='/' & testchar~=':' THEN bbspath=bbspath'/'
  51. extdevs=''
  52. DO i=1 TO WORDS(lynes.10)
  53.   test=WORD(lynes.10,i)
  54.   IF POS(':',test)=0 THEN ITERATE i
  55.   IF LEFT(test,2)='/*' THEN LEAVE i
  56.   extdevs=STRIP(extdevs test)
  57. END
  58. IF WORD(lynes.25,1)=1 THEN scratch=bbspath'Scratch'
  59. ELSE scratch='RAM:Scratch'
  60.  
  61. OPTIONS PROMPT ' Are you 'sysop'? (Yn) > '
  62. PULL answer
  63. IF answer='N' THEN
  64.   DO
  65.     SAY
  66.     OPTIONS PROMPT ' Please enter your name > '
  67.     PULL name
  68.     name=cleanstring('1:'name)
  69.     IF name='' THEN EXIT 
  70.     IF ~EXISTS(bbspath'Users/'name) THEN
  71.       DO
  72.         SAY name 'does not exist!'
  73.         EXIT
  74.       END
  75.   END
  76. ELSE name=sysop
  77. userfile=bbspath'Users/'name
  78. CALL OPEN(f,userfile,'R')
  79. data.=''
  80. DO i=1
  81.   line=READLN(f)
  82.   IF EOF(f) THEN LEAVE i
  83.   data.i=line
  84. END
  85. CALL CLOSE(f)
  86. data.0=i-1
  87. password=data.5
  88. linesperpage=20
  89. colorflag=1
  90. level=data.20
  91.  
  92. passprompt=pen3' Please Enter Password: '
  93. DO tries=1 TO 3
  94.   OPTIONS PROMPT passprompt
  95.   PULL newpassword
  96.   SAY def
  97.   IF(password=newpassword) THEN LEAVE tries; /* correct password */
  98.   IF tries=3 THEN
  99.     DO
  100.       SAY 
  101.       SAY 'Access terminated.'
  102.       SAY '*** Bad password ***' newpassword '***'
  103.       EXIT
  104.     END
  105.   passprompt='Incorrect.  Password: ' /* ask again */
  106. END
  107. SAY
  108. SAY' OK, 'name' here we go....'
  109. SAY
  110.  
  111. OPTIONS PROMPT pen3'Select: 'def
  112. DO FOREVER
  113.   CALL header(26)
  114.   DO i=1 TO 3
  115.     SAY CENTER(title.i,26)
  116.   END
  117.   SAY
  118.   SAY '        1. Doors'
  119.   SAY '        2. Files'
  120.   SAY '        3. Info'
  121.   SAY '        4. Mail'
  122.   SAY '        5. Messages'
  123.   SAY '        6. Users'
  124.   SAY '        Q. Quit'
  125.   PULL temp
  126.   temp=LEFT(temp,1)
  127.   IF temp=1 THEN CALL bbsDoors(3000 name password)
  128.   ELSE IF temp=2 THEN
  129.     DO subloop=1
  130.       CALL header(34)
  131.       SAY '        1. File Manager (Add-Edit-Browse)'
  132.       SAY '        2. Start File Usage Report'
  133.       SAY '        3. External Devices'
  134.       PULL temp
  135.       IF temp=1 THEN CALL bbsFile(name password)
  136.       ELSE IF temp=2 THEN
  137.         DO
  138.           SAY
  139.           SAY 'Enter -1 (or blank) for no least-downloaded-files report, or'
  140.           OPTIONS PROMPT 'enter smallest least-downloaded filesize to report > '
  141.           PULL filesize
  142.           IF ~DATATYPE(filesize,'W') THEN filesize=-1
  143.           IF filesize<-1 THEN filesize=-1
  144.           SAY
  145.           IF filesize>=0 THEN
  146.             SAY 'Includes least-used files larger than' filesize 'bytes.'
  147.           SAY 'The FILELISTS_REPORT will be left in email for you.'
  148.           SAY
  149.           ADDRESS AREXX bbsREPORT.rexx name 'FILES' filesize
  150.           OPTIONS PROMPT pen3'Select: 'def
  151.           LEAVE subloop
  152.         END
  153.       ELSE IF temp=3 THEN
  154.         DO
  155.           dl=bbsExtDL.baud(name level 3000 linesperpage colorflag extdevs)
  156.           IF dl='' THEN BREAK
  157.           topath=GETCLIP('BBS_topath')
  158.           IF topath='' THEN topath=GETCLIP('BBS_frompath')
  159.           todir=GetFile(150,36,topath,'',' Select Directory ',,'NOFILES')
  160.           IF RIGHT(todir,1)='/' THEN todir=LEFT(todir,LENGTH(todir)-1)
  161.           IF WORD(STATEF(todir),1)='DIR' THEN
  162.             DO
  163.               IF todir~=topath THEN CALL SETCLIP('BBS_topath')
  164.               DO i=1 TO WORDS(dl)
  165.                 mf=WORD(dl,i)
  166.                 SAY 'Copying' mf'...'
  167.                 ADDRESS COMMAND 'COPY' mf todir 'CLONE'
  168.               END
  169.             END
  170.           ELSE SAY pen3'*'def||todir||pen3'* is not a valid directory!'def
  171.         END
  172.       ELSE IF temp='Q' | temp='' THEN leave subloop
  173.     END
  174.   ELSE IF temp=3 THEN
  175.     DO subloop=1
  176.       CALL header(32)
  177.       SAY '        1. Daily log'
  178.       SAY '        2. Numbers log'
  179.       SAY '        3. QUICK log'
  180.       SAY '        4. USER log'
  181.       SAY '        5. Information'
  182.       SAY '        6. Scratch:'
  183.       SAY '        7. RAM:'
  184.       t=''
  185.       PULL temp
  186.       IF temp='' | temp='Q' THEN LEAVE subloop
  187.       ELSE IF temp=1 THEN
  188.         DO
  189.           OPTIONS PROMPT '['pen3'RETURN'def']=TODAY, or enter Log Date ('pen3||DATE('S')||def') > '
  190.           PULL t 
  191.           OPTIONS PROMPT pen3'Select: 'def
  192.           IF t='' THEN t=DATE('S')
  193.           t=bbspath'Logs/log.'t
  194.         END
  195.       ELSE IF temp=2 THEN t=bbspath'Logs/Numbers.log'
  196.       ELSE IF temp=3 THEN t=bbspath'Logs/QUICK.log'
  197.       ELSE IF temp=4 THEN t=bbspath'Usage/USER.LOG'
  198.       ELSE IF temp=5 THEN t=bbspath'Information/'
  199.       ELSE IF temp=6 THEN t=scratch'/'
  200.       ELSE IF temp=7 THEN t='RAM:'
  201.       IF t~='' THEN ADDRESS COMMAND reader t
  202.     END
  203.   ELSE IF temp=4 THEN
  204.     DO
  205.       CALL SETCLIP('BBSMAIL_ARG','1')
  206.       CALL bbsMail(3000 name password)
  207.       CALL SETCLIP('LOCAL_email')
  208.     END
  209.   ELSE IF temp=5 THEN CALL bbsMsg.rexx(3000 name password)
  210.   ELSE IF temp=6 THEN
  211.     DO subloop=1
  212.       CALL header(34)
  213.       SAY '        1. User Info'
  214.       SAY '        2. User Profiles'
  215.       IF level>sysoplevel THEN
  216.         DO
  217.           SAY '        3. New Users'
  218.           SAY '        4. Change UserName'
  219.           SAY '        5. Start Inactive Users Report'
  220.           SAY '        6. Kill A User'
  221.         END
  222.       PULL temp
  223.       IF temp=1 THEN
  224.         CALL bbsOther.rexx(3000 name sysoplevel 1 bbspath bbsname)
  225.       ELSE IF temp=2 THEN CALL bbsProfiles.rexx(name level sysoplevel 20 1 6000 bbspath)
  226.       ELSE IF temp=3 & level>sysoplevel THEN CALL bbsNewUsers.rexx(name level 1 3000)
  227.       ELSE IF temp=4 & level>sysoplevel THEN
  228.         DO
  229.           SAY
  230.           OPTIONS PROMPT 'Enter Current UserName > '
  231.           PULL oldname
  232.           IF oldname~='' THEN
  233.             DO
  234.               oldname=TRANSLATE(STRIP(oldname),'_',' ')
  235.               IF EXISTS(bbspath'/Users/'name) THEN CALL ChangeUserName(oldname)
  236.               ELSE SAY oldname 'does not have a userfile!'
  237.             END
  238.           OPTIONS PROMPT pen3'Select: 'def
  239.         END
  240.       ELSE IF temp=5 & level>sysoplevel THEN
  241.         DO
  242.           ADDRESS AREXX bbsREPORT.rexx name 'USERS'
  243.           SAY
  244.           SAY 'INACTIVE_USERS report will be left in email for you.'
  245.           SAY
  246.           LEAVE subloop
  247.         END
  248.       ELSE IF temp=6 & level>sysoplevel THEN CALL bbsKillUser()
  249.       ELSE IF temp='Q' | temp='' THEN leave subloop
  250.     END
  251.   ELSE IF temp='Q' THEN EXIT
  252. END
  253. EXIT
  254.  
  255. cleanstring:
  256. PARSE ARG nflag':'cstr
  257. namemask=COMPRESS(XRANGE(),XRANGE('A','Z')' _-')
  258. IF nflag=1 THEN
  259.   DO
  260.     cstr=COMPRESS(cstr,"'`")
  261.     cstr=TRANSLATE(cstr,,namemask)
  262.     cstr=SPACE(cstr,1,'_')
  263.     RETURN cstr
  264.   END
  265. bot=XRANGE(,'1F'x)
  266. top=XRANGE('7F'x)
  267. cstr=COMPRESS(cstr,bot||top)
  268. IF nflag=0 THEN cstr=STRIP(cstr)
  269. RETURN cstr
  270.  
  271.  
  272. header:
  273. ARG hnum 
  274. SAY
  275. SAY def
  276. SAY CENTER(STORAGE() 'bytes free.',hnum)
  277. SAY pen3||CENTER(name,hnum-1)||def
  278. RETURN
  279.  
  280. /* bbsMan.rexx */
  281.